{include file="public/header" /}
<style>
    .layui-flow-more{
        padding: 10px;
    }
</style>
<body class="hide-top bgc">
<div class="earnings-container">
    <img src="/static/index/img/icon36.png" alt="">
    <div class="earnings-content">
        <div class="earnings-hd flex-center">
            <i class="layui-icon layui-icon-left flex-center" onclick="history.go(-1)"></i>我的团队
        </div>

        <div class="wallet-list">
            <ul class="wallet-nav wallet-navs">
                <li>
                    <p>总人数</p>
                    <p class="num">{$team}</p>
                </li>
                <li>
                    <p>直推人数</p>
                    <p class="num">{$dpn}</p>
                </li>
                <li>
                    <p>直推业绩</p>
                    <p class="num">{$dpn_total}</p>
                </li>
            </ul>
            <ul class="wallet-nav wallet-navs">
                <li>
                    <p>团队业绩</p>
                    <p class="num">{$team_total}</p>
                </li>
                <li>
                    <p>上月新增</p>
                    <p class="num">{$user.last_month_total}</p>
                </li>
                <li>
                    <p>本月新增</p>
                    <p class="num">{$user.month_total}</p>
                </li>
            </ul>
        </div>
        <div class="index-search">
            <button style="background:none;height: 100%;display: flex;align-items: center;justify-content: center"> <img src="/static/index/img/icon7.png" alt=""></button>
            <input type="text" id="search" placeholder="请输入查询的会员手机号" value="">
        </div>
        <div class="my-team-content bgc">
            <p class="title">团队成员</p>
            <ul class="team-list tpl_list"></ul>
        </div>
    </div>
</div>

<script id="template" type="text/html">
    {{# for(var i=0 ;i < d.data.length; i++){ }}
    <li style="flex-wrap: wrap;padding-bottom: 1rem;" >
        <p class="flex-center" onclick="opens({{d.data[i].fresh.id}})">
            <img src="{{d.data[i].fresh.photo ? d.data[i].fresh.photo:'/static/index/img/photo.png'}}" alt="">
        </p>
        <div class="rgt">
            <p class="name">{{d.data[i].fresh.nickname}} {{# if(d.data[i].fresh.level){ }}<span>{{d.data[i].fresh.level.title}}</span>{{# } }}</p>
            <p>{{d.data[i].fresh.mobile}}</p>
        </div>
        {{# if(d.data[i].one.length > 0){ }}
        {{# for(var j=0;j < d.data[i].one.length;j++){ }}
        <ul style="flex: 0 0 100%;display: none" class="{{d.data[i].fresh.id}}">
            <li style="padding: 1rem;flex-wrap: wrap">
                <p class="flex-center">
                    <img src="{{d.data[i].one[j].fresh.photo ? d.data[i].one[j].fresh.photo:'/static/index/img/photo.png'}}" alt="">
                </p>
                <div class="rgt">
                    <p class="name">{{d.data[i].one[j].fresh.nickname}} {{# if(d.data[i].one[j].fresh.level){ }}<span>{{d.data[i].one[j].fresh.level.title}}</span>{{# } }}</p>
                    <p>{{d.data[i].one[j].fresh.mobile}}</p>
                </div>
                {{# if(d.data[i].one[j].two.length > 0){ }}
                {{# for(var k=0;k < d.data[i].one[j].two.length;k++){ }}
                <ul style="flex: 0 0 100%">
                    <li style="padding: 1rem;">
                        <p class="flex-center">
                            <img src="{{d.data[i].one[j].two[k].fresh.photo ? d.data[i].one[j].two[k].fresh.photo:'/static/index/img/photo.png'}}" alt="">
                        </p>
                        <div class="rgt">
                            <p class="name">{{d.data[i].one[j].two[k].fresh.nickname}} {{# if(d.data[i].one[j].two[k].fresh.level){ }}<span>{{d.data[i].one[j].two[k].fresh.level.title}}</span>{{# } }}</p>
                            <p>{{d.data[i].data[i].one[j].two[k].fresh.mobile}}</p>
                        </div>
                    </li>
                </ul>
                {{# } }}
                {{# } }}
            </li>
        </ul>
        {{# } }}
        {{# } }}
    </li>
    {{# } }}
</script>
</body>

{include file="public/footer"/}
<script>


    $(function () {
       getFlow(1, "{:url('user/my_team')}");
    });

    $('button').click(function() {
        var inputText = document.getElementById("search").value;
        if (!inputText) {
            layer.msg('请填写要搜索的内容');
            return false;
        }
        $(".tpl_list").empty();
        getFlow(1, "{:url('user/my_team')}?search="+inputText);

    });

    let $i = 0;
    function opens(id) {
        $i++;
        if($i % 2 == 0||$i==1)
        {
            $("."+id).show();
        }else {
            $("."+id).hide();
        }
    }

</script>
</html>